#include "DockWidgetTitleBarParent.h"
#include "Widgets/Mouse/MouseWidget.h"
#include "Widgets/Dock/DockWidgetTitleBarBase.h"
RDockWidgetTitleBarParent::RDockWidgetTitleBarParent()
{
    BackgroundMouse=NewWidget<RMouseWidget>(this);
    BackgroundMouse->Anchor.Fill(this);

    BackgroundMouse->Drag->bIsEnabled=true;
    //an empty  widget for drag
    auto BackgroundMouseDragTarget =NewWidget<RWidget>(this);
    BackgroundMouse->Drag->Target=(BackgroundMouseDragTarget);

}

void RDockWidgetTitleBarParent::SetContent(RDockWidgetTitleBarBasePtr InContent)
{
    if(Content.IsValid())
    {
        Content->RemoveFromParent();
    }
    Content=InContent;
    if(Content.IsValid())
    {
        AddSubWidget(Content);
        Content->Anchor.Fill(this);
    }
}
